import { FormGroup, FormControl } from "@angular/forms";

export function mobileValidator(control: FormControl): any{
  let reg = /^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
  let valid = reg.test(control.value);
  return valid ? null : { mobile: '手机号不符合规则' };
}
export function equalValidator(group: FormGroup): any {
  let pwd = group.get('pwd') as FormControl;
  let pConfirm = group.get('pwdConfirm') as FormControl;
  let valid = pwd.value === pConfirm.value;
  return valid ? null : { equal: '密码与确认密码不匹配' };
}
